
import java.io.Serializable;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author ntthinh
 */
public class WordImpl implements Word, Serializable {
private static final long serialVersionUID = 4L;
    private Category category;
    private List listProperty = new ArrayList();
    private String term;

    public Category myCategory()
            throws java.rmi.RemoteException {
        return this.category;
    }
     public void setMyCategory(Category categ){
        this.category=categ;
    }
     //ajouter un propriété
    public void addProperty(Property pro){
        this.listProperty.add(pro);
    }
     //fixer les propriétés de mot
     public void setMyProperties(Property[] pros){
          for(int i=0;i<pros.length;i++)
        this.listProperty.add(pros[i]);
     
    }
    public Property[] myProperties()
            throws java.rmi.RemoteException {
        //get list property
        Property[] properties = new PropertyImpl[listProperty.size()];
        for (int i = 0; i < listProperty.size(); i++) {
            properties[i] = (Property) listProperty.get(i);
        }
        return properties;

    }
    //getter

    public String getTerm()
            throws java.rmi.RemoteException {
        return term;
    }

    //setter
    public void setTerm(String term) {
        this.term = term;
    }
    //[1, NOM, « bail », <MASC, « baux »>]
    public String toFile() {
        String strWord = "« " + term + " », <";
      try {
            for(int i=0;i<listProperty.size();i++)
          {
              PropertyImpl tmpProperty=(PropertyImpl)listProperty.get(i);
              if(i==0) strWord+=tmpProperty.toFile();
              else
                  strWord+=","+ tmpProperty.toFile();
          }
        } catch (Exception e) {
            //e.printStackTrace();
        }

        strWord+=">";
        return strWord;
    }
}
